import * as methods from 'api/dashboard'
const dashboard = {
  state: {},
  mutations: {},
  actions: {
    _getArticle({commit}, params) {
      return new Promise((resolve, reject) => {
        methods.getArticle(params)
          .then((res) => {
            resolve(res)
          })
          .catch((err) => {
            reject(err)
          })
      })
    },
    _getIntroList({commit}, params) {
      return new Promise((resolve, reject) => {
        methods.getIntroList(params)
          .then((res) => {
            resolve(res)
          })
          .catch((err) => {
            reject(err)
          })
      })
    },
    _addFavor({commit}, params) {
      return new Promise((resolve, reject) => {
        methods.addFavor(params)
          .then((res) => {
            resolve(res)
          })
          .catch((err) => {
            reject(err)
          })
      })
    },
    _removeFavor({commit}, params) {
      return new Promise((resolve, reject) => {
        methods.removeFavor(params)
          .then((res) => {
            resolve(res)
          })
          .catch((err) => {
            reject(err)
          })
      })
    }
  }
}
export default dashboard
